<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <ul>
        <li>111</li>
        <li>222</li>
        <li>333</li>
    </ul>

    <script>
        /* 
            事件委托的原理就是事件冒泡的机制
            需求：点击li的时候，指定的li背景色变成绿色
         */
         const ulObj = document.querySelector("ul")
         ulObj.addEventListener("click",function(e){
            //  console.log("点击了ul")        //点击li，出现的是ul，是冒泡
            console.log(e.target)               //当前的具体对象
            e.target.style.backgroundColor = 'green'
         })
    </script>
    
</body>
</html>